<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>YCOJ首页</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/layui/2.6.8/css/layui.css">
    <script type="text/javascript" src="/constant.js"></script>
    <script type="text/javascript" src="/jquery/dist/jquery.min.js"></script>
    <script>
        /*判断用户是否登录*/
        // function CheckLogin() {
        var username = getCookie("username");
        var password = getCookie("password");
        console.log(username);
        console.log(password);
        //var information={user:username, passwd:password}; /*使用cookie传输*/
        $.ajax({
            type:'POST',
            // data:JSON.stringify(),
            contentType:'application/json',
            dataType:'text',
            url:'/CheckUserIfLogin',
            success:function (data) {
                console.log(data);
                /*说明cookie正确用户已经登录*/
                if (data == "true") {
                    console.log("true");
                    return;
                }
                else if(data == "false") {
                    console.log("false");
                    window.location.href= 'login.html';
                }
                else {
                    window.location.href= 'login.html';
                }
            }
        });
        // }
    </script>
</head>
<body>

<!-- 你的 HTML 代码 -->

<!--<script src="../layui/src/layui.js"></script>
<script>
    layui.use(['layer', 'form'], function(){
        var layer = layui.layer
            ,form = layui.form;

        layer.msg('Hello World');
    });
</script>-->


<div class="layui-container">
    <div class="layui-row layui-col-space10">
        <div class="layui-col-md12">
            <div class="layui-col-md10">
                <ul class="layui-nav layui-bg-green" lay-filter="menu">
                    <li class="layui-nav-item"><a href="index.html">YCOJ</a></li>
                    <li class="layui-nav-item layui-this"><a href="index.html">Home</a></li>
                    <li class="layui-nav-item"><a href="problem.html">Problem Set</a></li>
                    <li class="layui-nav-item"><a href="index.html">Contest</a></li>
                    <li class="layui-nav-item"><a href="status.html">Status</a></li>
                    <li class="layui-nav-item"><a href="index.html">FAQ</a></li>
                    <li class="layui-nav-item">
                        <a href="javascript:;">个人中心</a>
                        <dl class="layui-nav-child"> <!-- 二级菜单 -->
                            <dd><a href="submitLog.html">提交记录</a></dd>
                            <!--<dd><a href="">Modify</a></dd> 修改的页面放Userinfo里面-->
                            <dd><a href="/accountManageD.html">账号管理</a></dd>
                        </dl>
                    </li>
                </ul>
            </div>

            <div class="layui-col-md2">
                <ul class="layui-nav layui-bg-green">
                    <li class="layui-nav-item"><a href="login.html" >登录</a></li>
                    <li class="layui-nav-item"><a href="register.html">注册</a></li>
                </ul>
            </div>
        </div>

        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header layui-bg-blue">公告</div>
                <div class="layui-card-body">
                    <h1>欢迎来到YCOJ</h1>
                </div>
                <div class="layui-card-body">
                    <h3>祝刷题愉快(完整功能开发中)</h3>
                </div>
                <div class="layui-card-body">
                    <h4 align="right">By YCB&CYC</h4>
                </div>
            </div>
        </div>

        <div class="layui-col-md12 layui-col-space10">
            <div class="layui-col-md6">
                <div class="layui-card-header layui-bg-blue" align="center">排名</div>
                <table class="layui-table" lay-even lay-skin="nob">
                    <colgroup>
                        <col width="150">
                        <col width="200">
                        <col>
                    </colgroup>
                    <thead>
                    <tr>
                        <th>名次</th>
                        <th>用户</th>
                        <th>解题数目</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <td>1</td>
                        <td></td>
                        <td></td>
                    </tr>
                    <tr>
                        <td>2</td>
                        <td></td>
                        <td></td>
                    </tr>
                    <tr>
                        <td>3</td>
                        <td></td>
                        <td></td>
                    </tr>
                    <tr>
                        <td>4</td>
                        <td></td>
                        <td></td>
                    </tr>
                    </tbody>
                </table>
            </div>

            <div class="layui-col-md6">
                <div class="layui-card-header layui-bg-blue" align="center">提交记录</div>
                <table class="layui-table" lay-even lay-skin="nob">
                    <colgroup>
                        <col width="150">
                        <col width="200">
                        <col>
                    </colgroup>
                    <thead>
                    <tr>
                        <th>用户</th>
                        <th>题目</th>
                        <th>提交时间</th>
                        <th>结果</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td><span class="layui-badge layui-bg-green"></span></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td><span class="layui-badge layui-bg-green"></span></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td><span class="layui-badge layui-bg-green"></span></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td><span class="layui-badge layui-bg-green"></span></td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>

        <div class="layui-col-md12">
            <div class="layui-card-header layui-bg-blue" align="center">最近比赛</div>
            <table class="layui-table" lay-even lay-skin="nob">
                <colgroup>
                    <col width="150">
                    <col width="200">
                    <col>
                </colgroup>
                <thead>
                <tr>
                    <th>比赛名</th>
                    <th>开始时间</th>
                    <th>结束时间</th>
                    <th>类型</th>
                    <th>权限</th>
                    <th>状态</th>
                </tr>
                </thead>
                <tbody>
                <tr>
                    <td>2022ACM课程设计1-4</td>
                    <td>2022-04-01 14:00</td>
                    <td>2022-04-02 16:00</td>
                    <td><span class="layui-badge layui-bg-green">比赛</span></td>
                    <td><span class="layui-badge layui-bg-green">公开</span></td>
                    <td><span class="layui-badge layui-bg-red">已结束</span></td>
                </tr>
                <tr>
                    <td>2022ACM课程设计1-3</td>
                    <td>2022-04-01 14:00</td>
                    <td>2022-04-02 16:00</td>
                    <td><span class="layui-badge layui-bg-green">比赛</span></td>
                    <td><span class="layui-badge layui-bg-green">公开</span></td>
                    <td><span class="layui-badge layui-bg-red">已结束</span></td>
                </tr>
                </tbody>
            </table>
        </div>

        <div class="layui-col-md12 layui-bg-green">
            <div class="layui-col-md12" ><h1 align="center">开发者</h1></div>
            <hr>
            <div class="layui-col-md12"><h3 align="center">颜才博</h3></div>
            <div class="layui-col-md12"><h3 align="center">浙江理工大学信息学院计算机科学与技术</h3></div>
        </div>

    </div>
</div>
</div>



<script src="https://cdnjs.cloudflare.com/ajax/libs/layui/2.6.8/layui.js"></script>
<script>
    //注意：导航 依赖 element 模块，否则无法进行功能性操作
    layui.use('element', function(){
        var element = layui.element;//导航的hover效果、二级菜单等功能，需要依赖element模块

        //一些事件触发
        //监听导航点击的回调
        element.on('nav(menu)',function (elem) {
            //console.log(elem);
            layer.msg(elem.text());
        });
    });
</script>

<!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
</body>
</html>
